//
//  TransferManager.m
//  ChunLaiZhuangClient
//
//  Created by zzs on 16/4/10.
//  Copyright © 2016年 CLZ. All rights reserved.
//

#import "TransferManager.h"
//#import "ProductInfoViewController.h"
#import "ProductInfoViewController1.h"
#import "SearchResultWithProductViewController.h"
#import "CategoryListViewController.h"
#import "BrandCategoryViewController.h"
#import "BrandGroupModel.h"
#import "AppDelegate.h"
@implementation TransferManager
+(void)transferToSomeViewType:(NSString*)type linkID:(NSString*)linkID linkName:(NSString*)linkName fromView:(UIView*)currentView{
    UIViewController *currentVC=[UIView viewController:currentView];
    if ([type isEqualToString:@"product"]) {
        ProductInfoViewController1 *productVC=[[ProductInfoViewController1 alloc] initWithProductId:linkID];
        [currentVC.navigationController pushViewController:productVC animated:YES];
        
        
    }else if ([type isEqualToString:@"category"]){
        CategoryListViewController *productVC=[[CategoryListViewController alloc] init];
        productVC.linkID=linkID;
        productVC.navTitle=linkName;
        [currentVC.navigationController pushViewController:productVC animated:YES];
    }else if ([type isEqualToString:@"category-special"]){
        CategoryListViewController *productVC=[[CategoryListViewController alloc] init];
        productVC.linkID=linkID;
        productVC.navTitle=linkName;
        [currentVC.navigationController pushViewController:productVC animated:YES];

    }else if ([type isEqualToString:@"category-all"]){
        AppDelegate *delegate=[UIApplication sharedApplication].delegate;
        CustomTabBarViewController *tabBar=delegate.tabBarController;
        tabBar.selectedIndex=1;
        UIButton *btn = [tabBar.buttons objectAtIndex:1];
        [tabBar selectedTab:btn];
    }else if ([type isEqualToString:@"bee"]){
        AppDelegate *delegate=[UIApplication sharedApplication].delegate;
        CustomTabBarViewController *tabBar=delegate.tabBarController;
        tabBar.selectedIndex=2;
        UIButton *btn = [tabBar.buttons objectAtIndex:2];
        [tabBar selectedTab:btn];
    }else if ([type isEqualToString:@"brand"]){
        BrandCategoryViewController *productVC=[[BrandCategoryViewController alloc] init];
        BrandGroupDetailSubModel *subModel=[[BrandGroupDetailSubModel alloc] init];
        subModel.name=linkName;
        subModel.brand_id=linkID;
        productVC.brandDetailModel=subModel;
        [currentVC.navigationController pushViewController:productVC animated:YES];
    }else if ([type isEqualToString:@"link"]){
        CLZWebviewViewController *webVC=[[CLZWebviewViewController alloc] init];
        webVC.webUrl=linkID;
        [currentVC.navigationController pushViewController:webVC animated:YES];    }
}
@end
